<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
	xmlns:ogc="http://www.opengis.net/ogc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd
                      http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.1.0/expr.xsd">
	<namespaces>
	    <Namespace>
	        <prefix>xs</prefix>
	        <uri>http://www.w3.org/2001/XMLSchema</uri>
	    </Namespace>	    
		<Namespace>
			<prefix>gml</prefix>
			<uri>http://www.opengis.net/gml/3.2</uri>
		</Namespace>
	    <Namespace>
			<prefix>csml</prefix>
			<uri>http://ndg.nerc.ac.uk/csml</uri>
		</Namespace>
		<Namespace>
			<prefix>swe</prefix>
			<uri>http://www.opengis.net/swe/1.0/gml32</uri>
		</Namespace>
		<Namespace>
			<prefix>xlink</prefix>
			<uri>http://www.w3.org/1999/xlink</uri>
		</Namespace>
		<Namespace>
			<prefix>sa</prefix>
			<uri>http://www.opengis.net/sampling/1.0</uri>
		</Namespace>
	</namespaces>
	<sourceDataStores>
		<DataStore>
			<id>timeseries</id>
			<parameters>
				<Parameter>
					<name>directory</name>
					<value>file:./</value>
				</Parameter>
			</parameters>
		</DataStore>
	</sourceDataStores>
	<targetTypes>
		<FeatureType>
			<schemaUri>csmlMain.xsd</schemaUri>
		</FeatureType>
	</targetTypes>
	<typeMappings>
		<FeatureTypeMapping>
			<sourceDataStore>timeseries</sourceDataStore>
			<sourceType>timeseries</sourceType>
			<targetElement>csml:PointSeriesFeature</targetElement>
			<attributeMappings>
				<AttributeMapping>
					<targetAttribute>csml:PointSeriesFeature</targetAttribute>					
					<idExpression>
					    <OCQL>ID</OCQL>
					</idExpression>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>csml:location</targetAttribute>
					<sourceExpression>
						<OCQL>strConcat(strConcat(X_POS, ' '), Y_POS)</OCQL>
					</sourceExpression>
					<ClientProperty>
					    <name>srsName</name>
					    <value>'epsg:27700'</value>
					</ClientProperty>
					<ClientProperty>
					    <name>axisLabels</name>
					    <value>'Easting Northing'</value>
					</ClientProperty>
					<ClientProperty>
					    <name>uomLabels</name>
					    <value>'metre metre'</value>
					</ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage</targetAttribute>
					<ClientProperty>
					    <name>gml:id</name>
						<value>COVERAGE_ID</value>
					</ClientProperty>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries</targetAttribute>
					<idExpression>
						<OCQL>TIMESERIES_ID</OCQL>
					</idExpression>
				</AttributeMapping>
				<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage/csml:pointSeriesDomain/csml:TimeSeries/csml:timePositionList</targetAttribute>					
					<sourceExpression>
						<OCQL>FormatDateTimezone('yyyy-MM-dd', POSITION, 'UTC')</OCQL>
					</sourceExpression>
					<isList>true</isList>
     			</AttributeMapping>
     			<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage/gml:coverageFunction/gml:MappingRule</targetAttribute>
					<sourceExpression>
						<OCQL>'string'</OCQL>
					</sourceExpression>
				</AttributeMapping>
     			<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage/gml:rangeSet/gml:ValueArray</targetAttribute>
					<idExpression>
						<OCQL>VALUEARRAY_ID</OCQL>
					</idExpression>
				</AttributeMapping>
				<!-- Not using feature chaining, tested in TimeSeriesInlineWfsTest -->
			 	<AttributeMapping>
					<targetAttribute>csml:value/csml:PointSeriesCoverage/gml:rangeSet/gml:ValueArray/gml:valueComponent/gml:QuantityList</targetAttribute>
					<sourceExpression>
					    <OCQL>RANGE</OCQL>
					</sourceExpression>						
					<isList>true</isList>	
					<ClientProperty>
					    <name>uom</name>
					    <value>'degC'</value>
					</ClientProperty>	
				</AttributeMapping>
				<AttributeMapping>
				    <targetAttribute>csml:parameter</targetAttribute>
				    <ClientProperty>
					    <name>xlink:href</name>
					    <value>'http://cf-pcmdi.llnl.gov/documents/cf-standard-names/standard-name-table/current/cf-standard-name-table.html#surface_temperature'</value>
					</ClientProperty>
				</AttributeMapping>		 
			</attributeMappings>
		</FeatureTypeMapping>
	</typeMappings>
</as:AppSchemaDataAccess>